<template>
  <el-dialog v-bind="$attrs" v-model="confirmConfig.show" :title="confirmConfig.title || '提示'">
    <div>{{ confirmConfig.msg || '' }}</div>
    <template #footer>
      <slot name="footer"></slot>
      <hz-button @click="clickOk">{{ confirmConfig.okText || '确定' }}</hz-button>
      <hz-button @click="clickOn">{{ confirmConfig.noText || '取消' }}</hz-button>
    </template>
  </el-dialog>
</template>

<script setup >
import { onMounted, ref} from 'vue'

const props = defineProps({
  confirmConfig : {
    default: {
      show: true,
      msg: '确认信息',
      okText: '确定',
      noText: '取消',
      okCallback: () => {},
      noCallback: () => {},
    }
  },
})
const confirmConfig = props.confirmConfig;
// 确定
function clickOk() {
  confirmConfig.okCallback && confirmConfig.okCallback();
  confirmConfig.show = false;
}
// 取消
function clickOn() {
  if (confirmConfig.noCallback) {
    confirmConfig.noCallback();
  } else {
    confirmConfig.show = false;
  }
}

</script>
<style lang="scss">

</style>